﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter1.Section4
{
    public class Example02
    {
        public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
		public void Compute()
		{
            V.Coordinates c = new V.Coordinates();
            c.CartesianX = 1.0;
            c.CartesianY = -1.0;
            c.CartesianZ = 1.0;
            c.FromCartesianToSpherical();

            result += c.SphericalRho.ToString() + "   "
                + c.SphericalTheta.ToString() + "   "
                + c.SphericalAngleFromZ.ToString() + "\r\n";
            result += (Math.Sqrt(3.0)).ToString() + "   "
                + (7.0* Math.PI / 4.0 - 2.0*Math.PI).ToString() + "   "
                + (0.955).ToString() + "\r\n";

            V.Coordinates d = new V.Coordinates();
            d.SphericalRho = 3.0;
            d.SphericalTheta = Math.PI / 6.0;
            d.SphericalAngleFromZ = Math.PI / 4.0;
            d.FromSphericalToCartesian();

            result += d.CartesianX.ToString() + "   "
                + d.CartesianY.ToString() + "   "
                + d.CartesianZ.ToString() + "\r\n";
            result += (3.0*Math.Sqrt(3.0)/2.0/Math.Sqrt(2.0)).ToString() + "   "
                + (3.0 / 2.0 / Math.Sqrt(2.0)).ToString() + "   "
                + (3.0 * Math.Sqrt(2.0) / 2.0).ToString() + "\r\n"; 
        }
    }
}

/*  1.73205080756888   -0.785398163397448   0.955316618124509
    1.73205080756888   -0.785398163397448   0.955
1.83711730708738   1.06066017177982   2.12132034355964
1.83711730708738   1.06066017177982   2.12132034355964 */

